package com.ggk911.pharmacy_system.interceptor;

import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * 数据库字段填充字段拦截
 *
 * @author ggk-911
 * @version 1.0 2023/3/28 12:44
 */
@Component
public class MyMetaObjectHandler implements MetaObjectHandler {

    @Override
    public void insertFill(MetaObject metaObject) {
        this.setFieldValByName("purchaseCreateTime", new Date(), metaObject);
        this.setFieldValByName("purchaseOrderTime", new Date(), metaObject);
        this.setFieldValByName("putInStorageTime", new Date(), metaObject);
        this.setFieldValByName("drugSaleCreateTime", new Date(), metaObject);
        this.setFieldValByName("outboundDeliveryCreatTime", new Date(), metaObject);

    }

    @Override
    public void updateFill(MetaObject metaObject) {

    }
}
